const Mock = require('mockjs');
import {
  RANDOM
} from '@/utils/functions.js'

export const urlArr = [
  require('@/assets/model/model1.png'),
  require('@/assets/model/model3.png'),
  require('@/assets/model/model4.png'),
  require('@/assets/model/model5.png'),
  require('@/assets/model/model6.png'),
  require('@/assets/model/model7.png'),
  require('@/assets/model/model8.png'),
  require('@/assets/model/model9.png'),
  require('@/assets/model/model10.png'),
  require('@/assets/model/model11.png')
]

//返回的code
export const codeArr = [
  ...new Array(93).fill(200),
  // ...new Array(1).fill(401),
  // ...new Array(1).fill(403),
  // ...new Array(1).fill(404),
  // ...new Array(3).fill(500),
  // ...new Array(1).fill(503),
]
//返回的dataList
export const dataList = [{
    id: 1,
    time: '2022-01-15 10:39:00', //上传日期
    name: '报文1',
    describe: '其他一些信息',
    info: {
      analysis: true, //解析？
      target: true, //目标变量
      feature: true //成为特征变量?
    }
  },
  {
    id: 2,
    time: '2022-01-16 10:39:00', //上传日期
    name: '报文2',
    describe: '其他一些信息', //目标变量? 解析? 数据量? 特征?
    info: {
      analysis: false,
      target: false,
      feature: true
    }
  },
  {
    id: 3,
    time: '2022-01-17 10:39:00', //上传日期
    name: '报文3',
    describe: '其他一些信息', //目标变量? 解析? 数据量? 特征?
    info: {
      analysis: false,
      target: true,
      feature: false
    }
  }
]
//返回的解析后的列表
export const analysisResult = [{
    id: 7,
    title: 'pah_adminhonor',
  },
  {
    id: 8,
    title: 'pap_adminpenalty'
  }, {
    id: 9,
    title: 'pbs_basicsalvation'
  }, {
    id: 10,
    title: 'pca_basicinfo'
  }, {
    id: 11,
    title: 'pca_remark'
  }, {
    id: 12,
    title: 'pce_compulsoryexecution'
  }, {
    id: 13,
    title: 'pcj_civiljudgment'
  }, {
    id: 14,
    title: 'pco_baddebt'
  }, {
    id: 15,
    title: 'pco_creditcard'
  }, {
    id: 16,
    title: 'pco_credittrade'
  }, {
    id: 17,
    title: 'pco_delinquency'
  }, {
    id: 18,
    title: 'pco_nonrevolving'
  }, {
    id: 19,
    title: 'pco_recovery'
  }, {
    id: 20,
    title: 'pco_repayment'
  }, {
    id: 21,
    title: 'pco_revolvingcredit'
  }, {
    id: 22,
    title: 'pco_revolvingloan'
  }, {
    id: 23,
    title: 'pco_semicreditcard'
  }, {
    id: 24,
    title: 'pcr_basicinfo'
  }, {
    id: 25,
    title: 'pcr_remark'
  }, {
    id: 26,
    title: 'pda_1monthstatus'
  }, {
    id: 27,
    title: 'pda_24monthstatus'
  }, {
    id: 28,
    title: 'pda_5yearstatus'
  }, {
    id: 29,
    title: 'pda_basicinfo'
  }, {
    id: 30,
    title: 'pda_biglimitstages'
  }, {
    id: 31,
    title: 'pda_lateststatus'
  }, {
    id: 32,
    title: 'pda_remark'
  }, {
    id: 33,
    title: 'pda_specialevent'
  }, {
    id: 34,
    title: 'pda_specialtrade'
  }, {
    id: 35,
    title: 'phf_housefund'
  }, {
    id: 36,
    title: 'pim_basicinfo'
  }, {
    id: 37,
    title: 'pim_cellphone'
  }, {
    id: 38,
    title: 'pmm_marriage'
  }, {
    id: 39,
    title: 'pnd_basicinfo'
  }, {
    id: 40,
    title: 'pnd_remark'
  }, {
    id: 41,
    title: 'pno_postpay'
  }, {
    id: 42,
    title: 'pom_occupation'
  }, {
    id: 43,
    title: 'poq_otherquery'
  }, {
    id: 44,
    title: 'pos_otherstatement'
  }, {
    id: 45,
    title: 'pot_owingtaxes'
  }, {
    id: 46,
    title: 'ppo_publicinfo'
  }, {
    id: 47,
    title: 'ppq_practicequalification'
  }, {
    id: 48,
    title: 'pqo_lastquery'
  }, {
    id: 49,
    title: 'pqo_queryrecord'
  }, {
    id: 50,
    title: 'prh_dispute'
  }, {
    id: 51,
    title: 'prh_fraudwarning'
  }, {
    id: 52,
    title: 'prh_otherid'
  }, {
    id: 53,
    title: 'prh_report'
  }, {
    id: 54,
    title: 'prm_resident'
  }, {
    id: 55,
    title: 'psm_score'
  }
]
export const fileListData = () => {
  const fileList = []
  let i = 1
  const total = Math.round(Math.random() * 1000)
  while (i < total) {
    fileList.push({
      uid: 10000 + i,
      name: `一份${Mock.Random.cname()}的征信报告.html`
    })
    i += 1
  }
  return {
    fileList,
    total
  }
}
export const aSample = info => {
  let {
    id,
    type
  } = info
  if (type === undefined) type = Math.round(Math.random())
  if (id === undefined) id = RANDOM(15)
  let sample = {
    id,
    title: Mock.Random.csentence(5),
    time: Mock.Random.date('yyyy-MM-dd HH:mm'),
    description: Mock.Random.cparagraph(),
    type,
    targetRow: new Array(3).fill(undefined).filter(e => Math.random() > 0.5).map(e => Mock.Random.word())
  }
  if (type) sample.confInfo = {
    rootId: Mock.Random.pick(new Array(19).fill(undefined).map((e, index) =>
      `10010${index+1<10? '0'+(index+1):(index+1)}`), 1, 5),
    rootName: new Array(5).fill(undefined).filter(e => Math.random() > 0.5).map(e => Mock.Random.csentence(2, 5)),
    // 'rootName|1001001-1001019': 1,
    chooseType: Math.floor(Math.random() * 4),
    chooseNum: 100 + Math.floor(900 * Math.random()), //抽取数量
  }
  else sample.fileInfo = {
    fileName: Mock.Random.csentence(2, 5),
    // :total.match(/\d+/g)[1]
    total: `[${RANDOM(2)}x${RANDOM(3)}]`,
  }
  return {
    sample
  }
}
export const sampleList = () => {
  const resultList = []
  for (let id = 1235683; id < 20 * Math.random() + 10 + 1235683; id++) {
    const {
      sample
    } = aSample({
      id
    })
    resultList.push(sample)
  }
  return {
    sampleList: resultList
  }
}
export const targetList = () => {
  const targetNum = Math.ceil(Math.random() * 5)
  const listData = new Array(25).fill(undefined).map((e, i) => {
    i += 1
    const data = {
      reportno: `R000000${i<100? '0':''}${i<10? '0':''}${i}`,
      id: RANDOM(15)
    }
    for (i = 1; i <= targetNum; i++)
      data[`target${i}`] = Math.round(Math.random())
    return data
  })
  return {
    listData,
    targetNum
  }
}
export const modelListData = [{ //没有用到
    id: -1,
    title: '逻辑回归 vs 神经网络',
  }, {
    id: 1,
    title: '逻辑回归',
    description: '这是一个回归模型',
  }, {
    id: 2,
    title: '神经网络',
    description: '这是一个神经模型',
  }, {
    id: 3,
    title: '融合算法',
    description: '这是一个复杂模型',
  }, {
    id: 4,
    title: '逻辑回归2',
    description: '这是一个回归模型',
  }, {
    id: 5,
    title: '神经网络2',
    description: '这是一个神经模型',
  }, {
    id: 6,
    title: '算法2',
    description: '这是一个模型',
  },
  {
    id: 7,
    title: '算法2',
    description: '这是一个模型',
  },
].filter(e => e.id > 0)




